<template>
	<view class="w_100">
		<view v-for="(item,index) in dalist" :key="index" 
			@tap.stop="logOut(index)"
			:style="index==0 || index==2?'margin-top:20rpx;border-bottom:1rpx solid #EFEFEF ;':''"
			style="background-color: #FFFFFF;font-size: 30rpx;color: #343434;height: 100rpx;"
			class="w_100 d_f j_c_c a_i_c" >
			<view class="w_91 d_f " :class="index<2?'j_c_s_b':'j_c_c'">
				<text>{{item}}</text>
				<text v-if="index==1" style="color: #B9B9B9;font-size: 28rpx;">{{currentSize}}{{unit}}</text>
				<image src="/../../static/image/home/jtyou.png" mode="" style="width: 10rpx;height: 20rpx;" v-if="index==0"></image>	
			</view>
		</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				dalist:["修改密码","清除缓存","退出登录"],
				currentSize:"",
				unit:"",
				
			}
		},
		onShow() {
			this.currentSizeFun()
			console.log(uni.getStorageSync('token'))
			    
		},
		methods: {
			logOut(index){
				if(index==2){
					uni.switchTab({
					    url: '/pages/bottom-tab/home'
					});
					uni.removeStorageSync('uType');
					this.$funs.navt("/pages/logo-register/logo")
					return;
					if(!uni.getStorageSync('token') || !uni.getStorageSync('userId'))return this.$funs.show("您未登录",0)				 
					
						uni.showModal({
						    content:"确认退出吗？",
						    success: function (res) {
								console.log(res)
						        if (res.confirm) {
									uni.removeStorageSync('token');
									uni.removeStorageSync('imList');
									uni.switchTab({
									    url: '/pages/bottom-tab/home'
									});
						        } 
						    }
						});　
					 
					
				}else if(index==1){
					
					uni.removeStorageSync('userInfo');
					uni.removeStorageSync('imList');
					 // uni.clearStorageSync()
					 this.currentSizeFun()
				}else{
					this.$funs.navt("/pages/logo-register/forgetPass")
				}
			},
			currentSizeFun(){
				let res = uni.getStorageInfoSync();
				var currentSize=res.currentSize;
				if(currentSize<1048){
					this.currentSize=currentSize;
					this.unit="KB";
				}else{
					this.currentSize = currentSize/1048;
					this.unit="M";
				}
			}
		}
	}
</script>

<style>
page{
	background-color: #F6F6F6;
	
}
</style>
